<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
		<title></title>
		<style type="text/css">
			* {
				padding: 0;
				margin: 0;
			}
			.phone-preview {
				width: 100%;
				margin: 0 auto;
			}
			h3 {
				text-align: center;
				padding-top: 0.5rem;
				padding-bottom: 0.3rem;
			}
			.news-date {
				font-size: 0.7rem;
				text-align: center;
			}
			.news-content {
				margin-top: 0.5rem;
				padding: 0 0.5rem;
			}
		</style>

	</head>
	<body onload="ResizeImages()">
		<div class="phone-preview">
			<h3>${news.title}</h3>
			<div class="news-date">${news.create_date?string("yyyy-MM-dd HH:mm:ss")}</div>
			<div class="news-content" id="news-content">${news.content}</div>
		</div>
	</body>
    <script type="text/javascript" >

        //缩放图片到合适大小
        function ResizeImages()
        {
            var myimg,oldwidth,oldheight;
            var maxwidth=window.innerWidth -20;
            var maxheight=880;
            var imgs = document.getElementById('news-content').getElementsByTagName('img');   //如果你定义的id不是article，请修改此处

            for(i=0;i<imgs.length;i++){
                myimg = imgs[i];

                if(myimg.width > myimg.height)
                {
                    if(myimg.width > maxwidth)
                    {
                        oldwidth = myimg.width;
                        myimg.height = myimg.height * (maxwidth/oldwidth);
                        myimg.width = maxwidth;
                    }
                }else{
                    if(myimg.height > maxheight)
                    {
                        oldheight = myimg.height;
                        myimg.width = myimg.width * (maxheight/oldheight);
                        myimg.height = maxheight;
                    }
                }
            }
        }
        //缩放图片到合适大小
//        ResizeImages();
    </script>
</html>
